package fr.afcepf.atod19.appli.entity;

import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.xml.bind.annotation.XmlRootElement;

@Entity
//@Table(name="Compte")
@NamedQuery(name="findAllCompte",
      query="select c from Compte as c")
public class Compte {
	@Id
	@Column(name="numCpt")
	@GeneratedValue(strategy=GenerationType.AUTO)
	private Long numero;
	@Column(name="label", length=32)
	private String label;
	private Double solde;
	
	@ManyToMany( fetch = FetchType.LAZY,mappedBy="comptes")
	private List<Client> clients;

	@OneToMany(mappedBy="compte",fetch=FetchType.LAZY)
	private List<Operation> operations;
	
	public List<Operation> getOperations() {
		return operations;
	}
	public void setOperations(List<Operation> operations) {
		this.operations = operations;
	}
	public Long getNumero() {
		return numero;
	}
	public void setNumero(Long numero) {
		this.numero = numero;
	}
	public String getLabel() {
		return label;
	}
	public void setLabel(String label) {
		this.label = label;
	}
	public Double getSolde() {
		return solde;
	}
	public void setSolde(Double solde) {
		this.solde = solde;
	}
	public List<Client> getClients() {
		return clients;
	}
	public void setClients(List<Client> clients) {
		this.clients = clients;
	}
	
	
	
}
